import request from '@/utils/request'
import {AddRequest, ListRequest, StockOutDeleteRequest, SummaryRequest} from '@/interface/stockout'

export const StockOutListR = (req: ListRequest) => {
  return request({
    method: 'GET',
    url: '/stockout',
    params: req,
  })
}

//添加出库单
export const StockOutAddR = (req: AddRequest) => {
  req.date /= 1
  return request({
    method: 'POST',
    url: '/stockout',
    data: JSON.stringify(req),
  })
}

//删除出库单
export const StockOutRemoveR = (req:StockOutDeleteRequest) => {
  return request({
    method: 'DELETE',
    url: `/stockout`,
    params: req
  })
}


//修改出库单
export const StockOutUpdateR = (req: AddRequest) => {
  console.log('修改出库单表单:', req)
  req.date /= 1
  return request({
    method: 'PUT',
    url: '/stockout',
    data: JSON.stringify(req),
  })
}

//出库单汇总数据
export const StockOutTotalR = () => {
  return request({
    method: 'GET',
    url: '/stockout/total',
  })
}

//出库单汇总数据
export const StockOutSummaryR = (req:SummaryRequest) => {
  return request({
    method: 'GET',
    url: '/stockout/summary',
    params: req
  })
}